%{
#include "packetinfo.tab.h"
%}

%option noyywrap

%%

^"# === General packet description\n"		return GENERAL_BEGIN;
"packet_security_level="			return SEC_LEVEL;
"packet_version="				return VER_PACKET;
"system_version="				return VER_SYSTEM;
"packet_from="					return PACKET_FROM;
"packet_to="					return PACKET_TO;
"packet_number="				return PACKET_NUMBER;
"packet_prev="					return PACKET_PREV;
^"# === End general packet description\n"	return GENERAL_END;

^"# === Description tables\n"			return TABLES_START;
^"# === End tables description\n"		return TABLES_STOP;

^"# --- Description table"			return TABLE_START;
"."						return POINT;
","						return COMA;
"'"						return QUOTATION;
"("						return LBR;
")"						return RBR;

"pkey_fields="					return TABLE_PKEYS;
"other_fields="					return TABLE_OTHER;
"create_clause="				return TABLE_CREATE;
^"# --- End description\n"			return TABLE_STOP;

[0-9]*						packetinfolval.num=atoi(yytext);return NUMBER;
[[:alnum:]$_."]*				packetinfolval.str=strdup(yytext);return WORD;

[[:space:]]*					;

%%
